import Vue from 'vue'
import VueRouter from 'vue-router'
import BookManage from "../views/Book/BookManage";
import AddBook from "../views/Book/AddBook";
import UpdateBook from "../views/Book/UpdateBook";
import App from "../App";
import Index from "../views/Index";
import ReaderManage from "../views/Reader/ReaderManage";
import AddReader from "../views/Reader/AddReader";
import UpdateReader from "../views/Reader/UpdateReader";
import LendManage from "../views/Lend/LendManage";
import AddLend from "../views/Lend/AddLend";
import UpdateLend from "../views/Lend/UpdateLend";
import SuccessLend from "../views/Lend/SuccessLend";
import CanLend from "../views/Lend/CanLend";
import ReaderTest from "../views/Reader/ReaderTest";

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: '图书管理',
        component: Index,
        redirect: "/BookManage",
        show: true,
        children: [
            {
                path: '/bookManage',
                name: '查询图书',
                component: BookManage
            },
            {
                path: '/addBook',
                name: '添加图书',
                component: AddBook
            }
        ],
    },
    {
        path: '/updateBook',
        name: '修改图书',
        component: UpdateBook,
        show: false
    },
    {
        path: '/',
        name: '读者管理',
        component: Index,
        redirect: "/ReaderManage",
        show: true,
        children: [
            {
                path: '/ReaderManage',
                name: '查询读者',
                component: ReaderManage
            },
            {
                path: '/addReader',
                name: '添加读者',
                component: AddReader
            },
            {
                path: '/readerTest',
                name: '测试',
                component: ReaderTest
            }
        ],
    },
    {
        path: '/updateReader',
        name: '修改读者',
        component: UpdateReader,
        show: false
    },
    {
        path: '/',
        name: '借阅管理',
        component: Index,
        redirect: "/LendManage",
        show: true,
        children: [
            {
                path: '/LendManage',
                name: '查询借阅',
                component: LendManage
            },
            {
                path: '/canLend',
                name: '空闲图书',
                component: CanLend
            },
            {
                path: '/addLend',
                name: '添加借阅',
                component: AddLend
            },
            {
                path: '/successLend',
                name: '借阅历史',
                component: SuccessLend
            }
        ],
    },
    {
        path: '/updateLend',
        name: '修改借阅',
        component: UpdateLend,
        show: false
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
